package stream;

import stream.model.Student;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class DistinctDemo2 {
    public static void main(String[] args) {
        List<Student> studentList = new ArrayList<>();
        studentList.add(new Student(1, "张三", "M", 19, true));
        studentList.add(new Student(1, "李四", "M", 18, false));
        studentList.add(new Student(1, "王五", "F", 21, true));
        studentList.add(new Student(1, "赵六", "F", 20, false));
        studentList.add(new Student(1, "张三", "M", 19, true));
        studentList.add(new Student(1, "李四", "M", 18, false));
        studentList.add(new Student(1, "王五", "F", 21, true));
        studentList.add(new Student(1, "赵六", "F", 20, false));
        List<Student> result = studentList.stream().distinct().collect(Collectors.toList());
        System.out.println(result.toString());
    }
}
